/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vamprest;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author sav
 */
@Entity
@Table(name = "nfcequipment")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Nfcequipment.findAll", query = "SELECT n FROM Nfcequipment n"),
    @NamedQuery(name = "Nfcequipment.findByIdnfcequipment", query = "SELECT n FROM Nfcequipment n WHERE n.idnfcequipment = :idnfcequipment")})
public class Nfcequipment implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "idnfcequipment")
    private Integer idnfcequipment;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 65535)
    @Column(name = "description")
    private String description;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 65535)
    @Column(name = "nfctag")
    private String nfctag;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 65535)
    @Column(name = "nfcactivationcode")
    private String nfcactivationcode;
    @JoinColumn(name = "idvehicle", referencedColumnName = "idvehicle")
    @ManyToOne(optional = false)
    private Vehicle idvehicle;
    @JoinColumn(name = "idstatus", referencedColumnName = "idstatus")
    @ManyToOne(optional = false)
    private Status idstatus;
    @JoinColumn(name = "idmember", referencedColumnName = "idmember")
    @ManyToOne(optional = false)
    private Member idmember;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idnfcequipment")
    private Collection<Userequest> userequestCollection;

    public Nfcequipment() {
    }

    public Nfcequipment(Integer idnfcequipment) {
        this.idnfcequipment = idnfcequipment;
    }

    public Nfcequipment(Integer idnfcequipment, String description, String nfctag, String nfcactivationcode) {
        this.idnfcequipment = idnfcequipment;
        this.description = description;
        this.nfctag = nfctag;
        this.nfcactivationcode = nfcactivationcode;
    }

    public Integer getIdnfcequipment() {
        return idnfcequipment;
    }

    public void setIdnfcequipment(Integer idnfcequipment) {
        this.idnfcequipment = idnfcequipment;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getNfctag() {
        return nfctag;
    }

    public void setNfctag(String nfctag) {
        this.nfctag = nfctag;
    }

    public String getNfcactivationcode() {
        return nfcactivationcode;
    }

    public void setNfcactivationcode(String nfcactivationcode) {
        this.nfcactivationcode = nfcactivationcode;
    }

    public Vehicle getIdvehicle() {
        return idvehicle;
    }

    public void setIdvehicle(Vehicle idvehicle) {
        this.idvehicle = idvehicle;
    }

    public Status getIdstatus() {
        return idstatus;
    }

    public void setIdstatus(Status idstatus) {
        this.idstatus = idstatus;
    }

    public Member getIdmember() {
        return idmember;
    }

    public void setIdmember(Member idmember) {
        this.idmember = idmember;
    }

    @XmlTransient
    public Collection<Userequest> getUserequestCollection() {
        return userequestCollection;
    }

    public void setUserequestCollection(Collection<Userequest> userequestCollection) {
        this.userequestCollection = userequestCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idnfcequipment != null ? idnfcequipment.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Nfcequipment)) {
            return false;
        }
        Nfcequipment other = (Nfcequipment) object;
        if ((this.idnfcequipment == null && other.idnfcequipment != null) || (this.idnfcequipment != null && !this.idnfcequipment.equals(other.idnfcequipment))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "vamprest.Nfcequipment[ idnfcequipment=" + idnfcequipment + " ]";
    }

}
